<?php

namespace app\index\controller;
use pan\AjaxMessage;
use pan\Tools;
use think\Controller;

class Test extends Controller
{
    public function download(){
        return Tools::download('/static/test.pptx','test.pptx');
    }
    public  function  compress(){
        return Tools::compress(['/static/test.docx','/static/test.php'],'ok.zip');
    }
    public function  upload(){
        $file=request()->file('file');
        return AjaxMessage::success(Tools::upload($file));
    }
    public function uploads(){
        $files=request()->file('file');
        return AjaxMessage::success(Tools::uploads($files));
    }
    public  function email(){
        $subject='this is title';
        $body='this is content';
        $addressArr=[
            '734245514@qq.com',
            '739884281@qq.com'
        ];
        $from='734245514@qq.com';
        $fromName='company';
        $host='smtp.qq.com';
        $username='734245514@qq.com';
        $password='ojqauofdmmvrbffe';
        $AttachmentArr=[
           'pan.docx'=>'/static/test.docx',
            'pan.pptx'=>'/static/test.pptx'
        ];
        return AjaxMessage::success(Tools:: email($subject,$body,$addressArr,$from,$fromName,
            $host,$username,$password,$AttachmentArr));
    }
}
